package com.biz.impl;

import java.util.LinkedHashMap;
import java.util.List;

import com.biz.BaseBiz;
import com.dao.BaseDao;
import com.util.OrderBy;




public abstract class BaseBizImpl<T> implements BaseBiz<T> {
	public abstract BaseDao<T> getBaseDao();

	
	public void addEntity(T t) {
		getBaseDao().save(t);
	}


	public void update(T t) {
		getBaseDao().update(t);
	}


	public void delete(String where, Object... params) {
		getBaseDao().delete(where, params);
	}


	public List<T> getEntityAll() {
		return getBaseDao().queryList();
	}


	public List<T> getAllByProperty(String where, Object params) {
		return getBaseDao().queryList(where, params);
	}


	public List<T> getAllByProperty(String where1, Object params1,String where2, Object params2) {
		return getBaseDao().queryList(where1, params1, where2, params2);
	}

	public List<T> getAllByProperty(String string, Integer pageSize,
			String where, Object params) {
		// TODO Auto-generated method stub
		return null;
	}
	  public List<T> getAllByProperty(LinkedHashMap<String, OrderBy>  orderBy,String where, Object params) { 
		  return getBaseDao().queryList(orderBy,where, params); 
		  } 
	  
	  public List<T>  getAllByProperty(LinkedHashMap<String, OrderBy> orderBy,Integer  pageIndex,Integer pageSize,String where, Object params) {
		  return  getBaseDao().queryList(pageIndex,pageSize,orderBy,where, params);
		 }
	 

	public T getEntityByProperty(String propName, Object value) {
		return getBaseDao().get(propName, value);
	}
	
	public T getEntityByProperty(String propName, Object value, String propName1, Object value1) {
		return getBaseDao().get(propName, value,propName1, value1);
	}


	public Integer count(String where, Object... params) {
		return getBaseDao().count(where, params);
	}
}
